<template>
  <van-cell title="昵称" is-link to="/user/edit" :value="user.username"/>
  <van-cell title="账号" :value="user.userAccount"/>
  <van-cell title="头像" is-link to="/user/edit" :value="user.avatarUrl"/>
  <van-cell title="性别" is-link :value="user.gender" @click="toEdit('gender','性别',user.gender)"/>
  <van-cell title="电话" is-link to="/user/edit" :value="user.phone"/>
  <van-cell title="邮箱" is-link to="/user/edit" :value="user.email"/>
  <van-cell title="星球编号" :value="user.planetCode"/>
  <van-cell title="注册时间" :value="user.createTime"/>
</template>

<script setup lang="ts">
import userType from '../models/user';
import {reactive} from 'vue';
import { useRouter } from 'vue-router';

const router = useRouter();
let user = reactive<userType>({
  id: 1,
  username: 'string',
  userAccount: 'string',
  avatarUrl: 'string',
  gender: 1,
  phone: 'string',
  email: 'string',
  userStatus: 1,
  userRole: 1,
  planetCode: 'string',
  createTime: Date,
  tags: []
});

const toEdit = (editKey: string, editName: string, currentValue: string) => {
  router.push({
        path: '/user/edit',
        query: {
          editKey,
          editName,
          currentValue
        }
      }
  )
}

</script>

<style scoped>

</style>